package com.qipay.order.config;

/**
 * Creator: Yao
 * Date:    2017/9/25
 * For:网银网关的上游接口类型：请求接口返回pay_info、请求必须使用form表单提交页面的（页面直接跳转）
 * Other:
 */
public enum UnionOrderTypeStateEnum {

    PAY_INFO((byte) 0, "请求接口返回pay_info"),
    FORM_PAGE((byte) 1, "请求必须使用form表单提交页面");

    private Byte type;
    private String info;

    UnionOrderTypeStateEnum(Byte type, String info) {
        this.type = type;
        this.info = info;
    }

    public Byte getType() {
        return type;
    }

    public void setType(Byte type) {
        this.type = type;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public static String getInfo(Short type) {

        String info = "";

        for (UnionOrderTypeStateEnum p : UnionOrderTypeStateEnum.values()) {
            if (p.getType().equals(type)) {
                info = p.getInfo();
                break;
            }
        }

        return info;
    }

    public static UnionOrderTypeStateEnum getByType(Byte type) {
        for (UnionOrderTypeStateEnum p : UnionOrderTypeStateEnum.values()) {
            if (p.getType().equals(type)) {
                return p;
            }
        }
        return null;
    }
}
